import JavaMain.Birds

fun main(args: Array<String>) {
    var testBirds2: TestBirds2<JavaMain.Crow> = TestBirds2<JavaMain.Crow>()
    var crow: JavaMain.Crow = JavaMain.Crow("乌鸦")
    var crowList: MutableList<JavaMain.Crow> = mutableListOf(crow)
    var birdsList: MutableList<Birds> = mutableListOf()
    testBirds2.actionBirds4(birdsList, crowList)
}

class TestBirds2<T : Birds> {
    fun actionBirds2(birds: MutableList<out T>) {
        for (bird in birds) {
            bird.flight()
        }
    }

    fun actionBirds4(birds: MutableList<in T>, crow: MutableList<T>) {
        for (t: T in crow) {
            birds.add(t)
        }
    }
}